package com.example.ivos.dict.controller;

import com.example.ivos.base.response.JsonResult;
import com.example.ivos.dict.pojo.dto.DictQuery;
import com.example.ivos.dict.pojo.dto.DictSaveParam;
import com.example.ivos.dict.pojo.vo.DictVO;
import com.example.ivos.dict.service.DictService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/v1/dict")
public class DictController {
    @Autowired
    private DictService dictService;
    @GetMapping("/select")
    public JsonResult selectGeofence(DictQuery dictQuery) {
        List<DictVO> list=dictService.selectDict(dictQuery);
         return JsonResult.ok(list);
    }
    @PostMapping("/save")
    public JsonResult saveDict(DictSaveParam dictSaveParam) {
        dictService.saveDict(dictSaveParam);
        return JsonResult.ok();
    }
    @PostMapping("/delete/{id}")
    public JsonResult delete(@PathVariable Long id) {
        dictService.delete(id);
        return JsonResult.ok();
    }
}